home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Toolbox / MacCalendar 1.1b1 / MacCalendarSetup.r < prev    next >
Encoding:
Text File  |  1997-03-20  |  13.8 KB  |  504 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        MacCalendarSetup.r
  3.  
  4.     Contains:    Resources for the MacCalendar Setup application.
  5.  
  6.     Written by:    Quinn "The Eskimo!"
  7.  
  8.     Copyright:    © 1994-1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.     You may incorporate this sample code into your applications without
  13.     restriction, though the sample code has been provided "AS IS" and the
  14.     responsibility for its operation is 100% yours.  However, what you are
  15.     not permitted to do is to redistribute the source as "DSC Sample Code"
  16.     after having made changes. If you're going to re-distribute the source,
  17.     we require that you make it clear in the source that the code was
  18.     descended from Apple Sample Code, but that you've made changes.
  19. */
  20.  
  21. /////////////////////////////////////////////////////////////////////////
  22.  
  23. #define REZ
  24.  
  25. /////////////////////////////////////////////////////////////////////////
  26.  
  27. // Pick up resource constants common to both control strip
  28. // module and application.
  29.  
  30. #include "MacCalendarCommon.h"
  31.  
  32. // Pick up resource constants common to both C and Rez for
  33. // the application.
  34.  
  35. #include "MacCalendarSetup.h"
  36.  
  37. /////////////////////////////////////////////////////////////////////////
  38.  
  39. // Pick up system resource types.
  40.  
  41. #include "Pict.r"
  42. #include "Types.r"
  43. #include "SysTypes.r"
  44. #include "BalloonTypes.r"
  45.  
  46. /////////////////////////////////////////////////////////////////////////
  47.  
  48. resource 'vers' (1) {
  49.     kVersionMajor, kVersionMinor, kVersionStage, kVersionRelease, verUS,
  50.     kVersionIdent,
  51.     kVersionString
  52. };
  53.  
  54. /////////////////////////////////////////////////////////////////////////
  55.  
  56. // Define the bundle and Finder help.
  57.  
  58. type kSetupAppCreator as 'STR ';
  59.  
  60. resource kSetupAppCreator (0) {
  61.     "MacCalendarSetup: " kVersionString
  62. };
  63. resource 'BNDL' (BNDL_SetupApp) {
  64.     kSetupAppCreator, 0,
  65.     {
  66.         'FREF', {0, FREF_SetupApp};
  67.         'ICN#', {0, ICON_SetupApp};
  68.     }
  69. };
  70.  
  71. resource 'FREF' (FREF_SetupApp) {
  72.     'APPL', 0, ""
  73. };
  74.  
  75. resource 'hfdr' (kHMHelpID) {
  76.     HelpMgrVersion, hmDefaultOptions, 0, 0,
  77.     {
  78.         HMStringItem    {
  79.             "MacCalendarSetup\n\n"
  80.              "Use this application to configure the MacCalendar Control Strip module."
  81.         };
  82.     }
  83. };
  84.  
  85. /////////////////////////////////////////////////////////////////////////
  86.  
  87. // Define the main dialog along with its help, controls and popup menus.
  88.  
  89. resource 'DLOG' (DLOG_Setup, "Setup Dialog", purgeable) {
  90.         {  0 + 30, 0 + 30, 320 + 30, 290 + 30 },
  91.         dBoxProc,
  92.         invisible,
  93.         noGoAway,
  94.         0,
  95.         DLOG_Setup,
  96.         "",
  97. #if SystemSevenOrLater
  98.         alertPositionMainScreen
  99. #endif
  100. };
  101.  
  102. resource 'DITL' (DLOG_Setup, "Setup Dialog", preload, purgeable) {
  103.     {
  104.         { 290, 200, 310, 280 },    Button        { enabled, "OK"                        },
  105.         { 290,   4, 310,  80 },    Button        { enabled, "Cancel"                    },
  106.         {   4,   4, 176, 286 }, UserItem    { disabled /* Sample calendar */    },
  107. #define kFontPopupRect        { 230,  10, 250, 160 }
  108.         kFontPopupRect,            Control        { enabled, CNTL_FontPopup            },
  109. #define kFontSizePopupRect    { 230, 170, 250, 280 }
  110.         kFontSizePopupRect,        Control        { enabled, CNTL_SizePopup            },
  111. #define kFirstDayPopupRect    { 260,  10, 280, 280 }
  112.         kFirstDayPopupRect,        Control        { enabled, CNTL_FirstDayPopup        }, 
  113.         { 180,  10, 196, 282 }, UserItem    { disabled, /* Day labels */        },
  114.         { 200,    10, 216,  42 },    EditText    { enabled,    "Su"                    },
  115.         { 200,    50, 216,  82 },    EditText    { enabled,    "M"                        },
  116.         { 200,    90, 216, 122 },    EditText    { enabled,    "Tu"                    },
  117.         { 200, 130, 216, 162 },    EditText    { enabled,    "W"                        },
  118.         { 200, 170, 216, 202 },    EditText    { enabled,    "Th"                    },
  119.         { 200, 210, 216, 242 },    EditText    { enabled,    "F"                        },
  120.         { 200, 250, 216, 282 },    EditText    { enabled,    "Sa"                    },
  121. #if DEBUG
  122.         /*
  123.          * This lets us test the drawing algorithm without rebuilding the
  124.          * actual status bar and rebooting the machine.
  125.          */
  126.         { 290,  88, 310, 133 },    Button        { enabled, "Prev"                    },
  127.         { 290, 143, 310, 188 },    Button        { enabled, "Next"                    },
  128. #endif
  129.         {  0,   0,   0,   0}, HelpItem        { disabled, HMScanhdlg { HELP_Setup }},
  130.     }
  131. };
  132.  
  133. resource 'hdlg' (HELP_Setup, "Setup Dialog Help", purgeable) {
  134.         HelpMgrVersion,            /* Help version                */
  135.         0,                        /* Offset to first ditl        */
  136.         0,                        /* Options                    */
  137.         0,                        /* The Proc                    */
  138.         0,                        /* Variant                    */
  139.         HMSkipItem { },            /* No missing item strings    */
  140.         {
  141.             HMStringResItem {        /* kOKButton            */
  142.                 { 0, 0 }, { 0, 0, 0, 0 },
  143.                 STRN_SetupHelp, 1,
  144.                 0, 0,
  145.                 0, 0,
  146.                 0, 0
  147.             },
  148.             HMStringResItem {        /* kCancelButton        */
  149.                 { 0, 0 }, { 0, 0, 0, 0 },
  150.                 STRN_SetupHelp, 2,
  151.                 0, 0,
  152.                 0, 0,
  153.                 0, 0
  154.             },
  155.             HMStringResItem {        /* kCalendarUserItem    */
  156.                 { 0, 0 }, { 0, 0, 0, 0 },
  157.                 STRN_SetupHelp, 3,
  158.                 STRN_SetupHelp, 3,
  159.                 STRN_SetupHelp, 3,
  160.                 STRN_SetupHelp, 3,
  161.             },
  162.             HMStringResItem {        /* kFontNamePopupItem    */
  163.                 { 0, 0 }, { 0, 0, 0, 0 },
  164.                 STRN_SetupHelp, 4,
  165.                 STRN_SetupHelp, 4,
  166.                 STRN_SetupHelp, 4,
  167.                 STRN_SetupHelp, 4,
  168.             },
  169.             HMStringResItem {        /* kFontSizePopupItem    */
  170.                 { 0, 0 }, { 0, 0, 0, 0 },
  171.                 STRN_SetupHelp, 5,
  172.                 STRN_SetupHelp, 5,
  173.                 STRN_SetupHelp, 5,
  174.                 STRN_SetupHelp, 5,
  175.             },
  176.             HMStringResItem {        /* kFirstDayPopupItem    */
  177.                 { 0, 0 }, { 0, 0, 0, 0 },
  178.                 STRN_SetupHelp, 6,
  179.                 STRN_SetupHelp, 6,
  180.                 STRN_SetupHelp, 6,
  181.                 STRN_SetupHelp, 6,
  182.             },
  183.             HMSkipItem { },            /* kDayNameUserItem        */
  184.             HMStringResItem {        /* kSundayText            */
  185.                 { 0, 0 }, { 0, 0, 0, 0 },
  186.                 STRN_SetupHelp, 7,
  187.                 STRN_SetupHelp, 7,
  188.                 STRN_SetupHelp, 7,
  189.                 STRN_SetupHelp, 7,
  190.             },
  191.             HMStringResItem {        /* kMondayText            */
  192.                 { 0, 0 }, { 0, 0, 0, 0 },
  193.                 STRN_SetupHelp, 8,
  194.                 STRN_SetupHelp, 8,
  195.                 STRN_SetupHelp, 8,
  196.                 STRN_SetupHelp, 8,
  197.             },
  198.             HMStringResItem {        /* kTuesdayText            */
  199.                 { 0, 0 }, { 0, 0, 0, 0 },
  200.                 STRN_SetupHelp, 9,
  201.                 STRN_SetupHelp, 9,
  202.                 STRN_SetupHelp, 9,
  203.                 STRN_SetupHelp, 9,
  204.             },
  205.             HMStringResItem {        /* kWednesdayText        */
  206.                 { 0, 0 }, { 0, 0, 0, 0 },
  207.                 STRN_SetupHelp,10,
  208.                 STRN_SetupHelp,10,
  209.                 STRN_SetupHelp,10,
  210.                 STRN_SetupHelp,10,
  211.             },
  212.             HMStringResItem {        /* kThursdayText        */
  213.                 { 0, 0 }, { 0, 0, 0, 0 },
  214.                 STRN_SetupHelp,11,
  215.                 STRN_SetupHelp,11,
  216.                 STRN_SetupHelp,11,
  217.                 STRN_SetupHelp,11,
  218.             },
  219.             HMStringResItem {        /* kFridayText            */
  220.                 { 0, 0 }, { 0, 0, 0, 0 },
  221.                 STRN_SetupHelp,12,
  222.                 STRN_SetupHelp,12,
  223.                 STRN_SetupHelp,12,
  224.                 STRN_SetupHelp,12,
  225.             },
  226.             HMStringResItem {        /* kSaturdayText        */
  227.                 { 0, 0 }, { 0, 0, 0, 0 },
  228.                 STRN_SetupHelp,13,
  229.                 STRN_SetupHelp,13,
  230.                 STRN_SetupHelp,13,
  231.                 STRN_SetupHelp,13,
  232.             },
  233.         }
  234. };
  235.  
  236. resource 'STR#' (STRN_SetupHelp, "Setup Dialog Help Strings", purgeable) {
  237.     {    /* [1]    kOKButton                                    */
  238.         "Click this button to update the MacCalendar parameter"
  239.         " resource. Changes take effect after you restart"
  240.         " the computer.",
  241.         /* [2]    kCancelButton                                */
  242.         "Click this button to exit the MacCalendar Setup application"
  243.         " without changing the MacCalendar parameter resource.",
  244.         /* [3] kCalendarUserItem                            */
  245.         "This shows what the calendar will look like after"
  246.         " you click the OK button and restart your computer.",
  247.         /* [4] kFontNamePopupItem                            */
  248.         "This popup menu lets you select the font used to"
  249.         " display the calendar.",
  250.         /* [5] kFontSizePopupItem                            */
  251.         "This popup menu lets you select the font size used"
  252.         " to display the calendar.",
  253.         /* [6] kFirstDayPopupItem                            */
  254.         "This popup menu lets you select the first (leftmost)"
  255.         " day of the week: either Sunday or Monday.",
  256.         /* [7] kSundayText                                    */
  257.         "Sunday: the first day of the week. Derived from late"
  258.         " Latin “dies solis” - day of the sun.",
  259.         /* [8] kMondayText                                    */
  260.         "Monday: the second day of the week. Derived from late"
  261.         " Latin “Lunæ dies” - moon’s day (compare French Lundi).",
  262.         /* [9] kTuesdayText                                    */
  263.         "Tuesday: the third day of the week. Derived from Old"
  264.         " High German “Zîo,” an ancient Teutonic diety, identified"
  265.         " with the Roman Mars; whence “Tíwesdag,” rendering"
  266.         " late Latin “dies Martis” (compare French Mardi).",
  267.         /* [10] kWednesdayText                                */
  268.         "Wednesday: the fourth day of the week. “The day of"
  269.         " (the god) Woden,” a translation of late Latin"
  270.         " “Mercurii dies” whence the name of the day in"
  271.         " the Romance languages.",
  272.         /* [11] kThursdayText                                */
  273.         "Thursday: the fifth day of the week. Derived mainly from"
  274.         " Old Norse “Tórsdagr” ‘day of Thunor or Thor.’ Middle"
  275.         " Germanic Donderday (modern German Donnerstag) derives"
  276.         " from late Latin ”dies Jovis” (compare French Jeudi).",
  277.         /* [12] kFridayText                                    */
  278.         "Friday: the sixth day of the week. Derived from Old"
  279.         " English “Frígedæg” ‘day of (the goddess) Fríg’ from"
  280.         " Old Norse “Frigg” the wife of Odin.",
  281.         /* [13] kSaturdayText                                */
  282.         "Saturday: the seventh day of the week. A half-translated"
  283.         " adoption of Latin “Saturni dies” ‘day of (the planet)"
  284.         " Saturn.’",
  285.     }
  286. };
  287.  
  288. resource 'CNTL' (CNTL_FontPopup, preload, purgeable) {
  289.     kFontPopupRect,                        /* Must match DITL above            */
  290.     popupTitleLeftJust,                    /* Left-justify                        */
  291.     visible,
  292.     41,                                    /* Title width                        */
  293.     MENU_Font,                            /* Font menu                        */
  294.     popupMenuCDEFProc,                    /* It's a popup menu                */
  295.     0,                                    /* refCon, unused                    */
  296.     "Font:"                                /* Title                            */
  297. };
  298.  
  299. resource 'MENU' (MENU_Font, "Font Menu") {
  300.     MENU_Font,
  301.     textMenuProc,
  302.     allEnabled,
  303.     enabled,
  304.     "Font",
  305.     { }
  306. };
  307.  
  308. resource 'CNTL' (CNTL_SizePopup, preload, purgeable) {
  309.     kFontSizePopupRect,                    /* Must match DITL above            */
  310.     popupTitleLeftJust | popupFixedWidth, /* Left-justify                    */
  311.     visible,
  312.     41,                                    /* Title width                        */
  313.     MENU_FontSize,                        /* Font Size menu                    */
  314.     popupMenuCDEFProc,                    /* It's a popup menu                */
  315.     0,                                    /* refCon, unused                    */
  316.     "Size:"                                /* Title                            */
  317. };
  318.  
  319. resource 'MENU' (MENU_FontSize, "Font Size Menu") {
  320.     MENU_FontSize,
  321.     textMenuProc,
  322.     allEnabled,
  323.     enabled,
  324.     "Size",
  325.     {
  326.          "9", noIcon, noKey, noMark, plain,
  327.         "10", noIcon, noKey, noMark, plain,
  328.         "12", noIcon, noKey, noMark, plain,
  329.         "14", noIcon, noKey, noMark, plain,
  330.         "16", noIcon, noKey, noMark, plain,
  331.         "18", noIcon, noKey, noMark, plain,
  332.         "24", noIcon, noKey, noMark, plain,
  333.         "36", noIcon, noKey, noMark, plain,
  334.     }
  335. };
  336.  
  337. resource 'CNTL' (CNTL_FirstDayPopup, preload, purgeable) {
  338.     kFirstDayPopupRect,                    /* Must match DITL above            */
  339.     popupTitleLeftJust,                    /* Left-justify                        */
  340.     visible,
  341.     135,                                /* Title width                        */
  342.     MENU_FirstDay,                        /* Font menu                        */
  343.     popupMenuCDEFProc,                    /* It's a popup menu                */
  344.     0,                                    /* refCon, unused                    */
  345.     "First Day of the Week:"            /* Title                            */
  346. };
  347.  
  348. resource 'MENU' (MENU_FirstDay, "First Day of the Week") {
  349.     MENU_Font,
  350.     textMenuProc,
  351.     allEnabled,
  352.     enabled,
  353.     "Fonts",
  354.     {
  355.         "Sunday", noIcon, noKey, noMark, plain,
  356.         "Monday", noIcon, noKey, noMark, plain,
  357.     }
  358. };
  359.  
  360. /////////////////////////////////////////////////////////////////////////
  361.  
  362. // Define the menus.
  363.  
  364. resource 'MBAR' (MBAR_MenuBar) {
  365.     {
  366.         MENU_Apple,
  367.         MENU_File,
  368.         MENU_Edit
  369.     }
  370. };
  371.  
  372. resource 'MENU' (MENU_Apple, "Apple Menu") {
  373.     MENU_Apple,
  374.     textMenuProc,
  375.     0x7FFFFFFC,
  376.     enabled,
  377.     apple,
  378.     {
  379.         "© 1993 Apple Computer Inc.", noIcon, noKey, noMark, plain,
  380.         "-", noIcon, noKey, noMark, plain
  381.     }
  382. };
  383.  
  384. resource 'MENU' (MENU_File, "File Menu") {
  385.     MENU_File,
  386.     textMenuProc,
  387.     allEnabled,
  388.     enabled,
  389.     "File",
  390.     {    
  391.         "Quit", noIcon, "Q", noMark, plain
  392.     }
  393. };
  394.  
  395. resource 'MENU' (MENU_Edit, "Edit Menu") {
  396.     MENU_Edit,
  397.     textMenuProc,
  398.     0x0,
  399.     enabled,
  400.     "Edit",
  401.     {
  402.         "Undo", noIcon, "Z", noMark, plain,
  403.         "-", noIcon, noKey, noMark, plain,
  404.         "Cut", noIcon, "X", noMark, plain,
  405.         "Copy", noIcon, "C", noMark, plain,
  406.         "Paste", noIcon, "V", noMark, plain,
  407.         "Clear", noIcon, noKey, noMark, plain
  408.     }
  409. };
  410.  
  411. /////////////////////////////////////////////////////////////////////////
  412.  
  413. // Define the error alerts and strings.
  414.  
  415. resource 'ALRT' (ALRT_NonFatalError, "Non-fatal Error") {        
  416.     {  85,  85, 260, 400 },
  417.     ALRT_NonFatalError,
  418.     {
  419.         OK, visible, silent,
  420.         OK, visible, silent,
  421.         OK, visible, silent,
  422.         OK, visible, silent,
  423.     },
  424. #if SystemSevenOrLater
  425.         alertPositionMainScreen
  426. #endif
  427. };
  428.  
  429. resource 'DITL' (ALRT_NonFatalError, "Non-fatal Error") {
  430.     {
  431.         { 140, 240, 160, 305 },    Button        { enabled,    "Exit" /* kOKButton */    },
  432.         { 140, 140, 160, 230 },    Button        { enabled,    "Continue"                },
  433.         {  26,  86, 130, 305},    StaticText    { disabled,
  434.             "System Error ^0 (^1): ^2"                                            },
  435.     }
  436. };
  437.  
  438. resource 'ALRT' (ALRT_FatalError, "Fatal Error") {        
  439.     {  85,  85, 260, 400 },
  440.     ALRT_FatalError,
  441.     {
  442.         OK, visible, silent,
  443.         OK, visible, silent,
  444.         OK, visible, silent,
  445.         OK, visible, silent,
  446.     },
  447. #if SystemSevenOrLater
  448.         alertPositionMainScreen
  449. #endif
  450. };
  451.  
  452. resource 'DITL' (ALRT_FatalError, "Fatal Error") {
  453.     {
  454.         { 140, 240, 160, 305 },    Button        { enabled,    "Exit"                    },
  455.         {  26,  86, 130, 305},    StaticText    { disabled,
  456.             "Fatal Error ^0 (^1): ^2"                                            },
  457.     }
  458. };
  459.  
  460. resource 'ALRT' (ALRT_NoPreferences, "No preference resource or file") {        
  461.     {  85,  85, 280, 480 },
  462.     ALRT_NoPreferences,
  463.     {
  464.         OK, visible, silent,
  465.         OK, visible, silent,
  466.         OK, visible, silent,
  467.         OK, visible, silent,
  468.     },
  469. #if SystemSevenOrLater
  470.         alertPositionMainScreen
  471. #endif
  472. };
  473.  
  474. resource 'DITL' (ALRT_NoPreferences, "No preference resource or file") {
  475.     {
  476.         { 160, 320, 180, 385 },    Button        { enabled,    "Exit"                    },
  477.         {  26,  86, 150, 385},    StaticText    { disabled,
  478.             "Can't find the Control Strip preference.\n"
  479.             "Please check that the MacCalendar Control Strip has been installed"
  480.             " correctly. If you have just installed it, please restart"
  481.             " your computer and try again."
  482.         },
  483.     }
  484. };
  485.  
  486. resource 'STR#' (STRN_Messages, "Various messages") {
  487.     {
  488.         "System Error",
  489.     }
  490. };
  491.  
  492. type 'Estr' as 'STR ';
  493. resource 'Estr'    (-23)                { "openErr: Can't open file (permissions)"    };
  494. resource 'Estr'    (-27)                { "abortErr: I/O terminated"                };
  495. resource 'Estr'    (-33)                { "dirFulErr: Disk full: can't write data"    };
  496. resource 'Estr'    (-36)                { "ioErr: General I/O error (bummers)"        };
  497. resource 'Estr'    (-41)                { "mFulErr: Memory full (file won't fit)"    };
  498. resource 'Estr'    (-43)                { "fnfErr: File not found"                    };
  499. resource 'Estr'    (-50)                { "paramErr: Error in user parameter block"    };
  500. resource 'Estr'    (-108)                { "memErr: Out of memory"                    };
  501. resource 'Estr' (-109)                { "nilHandleErr: Unexpected NULL handle"    };
  502. resource 'Estr'    (-192)                { "resNotFound: Missing resource"            };
  503. resource 'Estr'    (-4101)                { "No printer selected in Chooser"            };
  504.